package com.kexin.jbsg.feiliu;

import android.app.TabActivity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;
import android.widget.TabHost.TabSpec;
import android.widget.TabWidget;
import android.widget.TextView;

/**
 * @author oven:
 * @version 创建时间：2013-4-20 上午10:11:43
 * 
 */
public class PayActivity extends TabActivity{
	
	public static final String createOrderUrl = "http://login.efgame.cn:8080/kom_payResponse_new/FeiLiuRecharge?";
	//public static final String createOrderUrl = "http://192.168.2.200:8080/kom_payResponse/FeiLiuRecharge?";
//	public static final String createOrderUrl = "http://116.255.235.123:8090/kom_payResponse/FeiLiuRecharge?";
	public static final String key="feiliu";
	
	public static String userId;
	public static String userRoleId;
	public static String serverId;
	public static String roleName;
	public static String channel;
	
	 /**
     * TabHost控件
     */
    private TabHost mTabHost;

    /**
     * TabWidget控件
     */
    private TabWidget mTabWidget;
    
    @Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.pay_activity_tab);
		
		//获取数据
		Intent intent = this.getIntent();
		userId = intent.getStringExtra("userId");
		userRoleId = intent.getStringExtra("userRoleId");
		serverId = intent.getStringExtra("serverId");
		roleName = intent.getStringExtra("roleName");
		channel = intent.getStringExtra("channel");
		
		mTabHost = getTabHost();
		mTabWidget = getTabWidget();
		
		 /* 去除标签下方的白线 */
        mTabHost.setPadding(mTabHost.getPaddingLeft(),
                mTabHost.getPaddingTop(), mTabHost.getPaddingRight(),
                mTabHost.getPaddingBottom() - 5);
		
		Intent tab1 = new Intent(this,PayActivityCard.class);
		TabSpec tab1Spec = mTabHost.newTabSpec("充值卡")
				//tab名称  图标
				.setIndicator("充值卡", getResources().getDrawable(R.drawable.pay_cardico))
				//content
				.setContent(tab1);
		mTabHost.addTab(tab1Spec);
		
		Intent tab2 = new Intent(this,PayActivityAlipay.class);
		TabSpec tab2Spec = mTabHost.newTabSpec("支付宝")
				//tab名称  图标
				.setIndicator("支付宝", getResources().getDrawable(R.drawable.pay_alicon))
				//content
				.setContent(tab2);
		mTabHost.addTab(tab2Spec);
		
		
		 for (int i = 0; i < mTabWidget.getChildCount(); i++)
	        {
	            /* 得到每个标签的视图 */
	            View view = mTabWidget.getChildAt(i);
	            /* 设置每个标签的背景 */
	            if (mTabHost.getCurrentTab() == i)
	            {
//	                view.setBackgroundDrawable(getResources().getDrawable(
//	                        R.drawable.tab_sel));
//	            	view.setBackgroundColor(0x1f82e7);
	            }
	            else
	            {
//	                view.setBackgroundDrawable(getResources().getDrawable(
//	                        R.drawable.tab_unsel));
//	            	view.setBackgroundColor(0xdddede);
	            }
	            /* 设置Tab间分割竖线的颜色 */
	            // tabWidget.setBackgroundColor(Color.WHITE);
	            /* 设置Tab间分割竖线的背景图片 */
	            // tabWidget.setBackgroundResource(R.drawable.icon);
	            /* 设置tab的高度 */
	            mTabWidget.getChildAt(i).getLayoutParams().height = 70;
	            TextView tv = (TextView) mTabWidget.getChildAt(i).findViewById(
	                    android.R.id.title);
	            /* 设置tab内字体的颜色 */
	            tv.setTextColor(Color.rgb(255,255,255));
	            tv.setTextSize(18);
	        }

	        /* 当点击Tab选项卡的时候，更改当前Tab标签的背景 */
	        mTabHost.setOnTabChangedListener(new OnTabChangeListener()
	        {
	            @Override
	            public void onTabChanged(String tabId)
	            {
	                for (int i = 0; i < mTabWidget.getChildCount(); i++)
	                {
	                    View view = mTabWidget.getChildAt(i);
	                    if (mTabHost.getCurrentTab() == i)
	                    {
//	                        view.setBackgroundDrawable(getResources().getDrawable(
//	                                R.drawable.tab_sel));
//	                    	view.setBackgroundColor(0x1f82e7);
	                    }
	                    else
	                    {
//	                        view.setBackgroundDrawable(getResources().getDrawable(
//	                                R.drawable.tab_unsel));
//	                    	view.setBackgroundColor(0xdddede);
	                    }
	                }
	            }
	        });
	}

}

